package com.monday.graphql.resolver;

import com.monday.graphql.model.Book;
import graphql.kickstart.tools.GraphQLQueryResolver;

import java.util.ArrayList;
import java.util.List;

public class Query implements GraphQLQueryResolver {

    public List<Book> books() {
        List<Book> books = new ArrayList<>();
        Book book1 = new Book();
        books.add(book1);
        book1.setAuthorId(1001);
        book1.setId(1);
        book1.setName("了不起的盖茨比");

        Book book2 = new Book();
        books.add(book2);
        book2.setAuthorId(1002);
        book2.setId(2);
        book2.setName("瓦尔登湖");

        return books;
    }
}